<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<input type="button" value="点我" id="btn">
<input type="button" value="点我" id="btn2">
<script>

    var foo = function (){
        alert('你好');
    }


    var foo2 = function (){
        alert('你点到我了');
        return undefined;
    }
    var btn = document.getElementById('btn');
    var btn2 = document.getElementById('btn2');
    btn.onclick = function (){
        alert('你点到我了');
        return undefined;
    };
    btn2.onclick = function (){
        alert('你点到我了222');
        return undefined;
    };

</script>
</body>
</html>